Skip to content

fix index check on trygetvalue - #109

Merged
Aaronontheweb merged 1 commit into
akkadotnet:devfrom
to11mtm:fixup-formatterLookup-index
Feb 8, 2026
Merged

fix index check on trygetvalue#109
Aaronontheweb merged 1 commit into
akkadotnet:devfrom
to11mtm:fixup-formatterLookup-index

Conversation

@to11mtm

@to11mtm to11mtm commented Feb 8, 2026

Copy link
Copy Markdown
Member

Changes

Fixes an index check on IntIndexedMessagePackFormatterDict to avoid a potential Index out of range exception

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

@to11mtm
to11mtm requested a review from Arkatufus February 8, 2026 18:29

@to11mtm to11mtm left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self review

//Shouldn't happen much and only on startup...
var f = _formatters;
if (i > f.Length)
if (i >= f.Length)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are going to index into an array based on this check...

I am somewhat surprised that we haven't seen this come up as an issue filed on the lib...

That said there are possibly times where this could result in transient failures; i.e. if you had 257 types, it's possible the 256'th would transiently fail, but once the 257'th got loaded, the 256th type would be good to go again...

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb
Aaronontheweb merged commit 1224c61 into akkadotnet:dev Feb 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants